package com.woniuxy.main.handler;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.main.service.Index_adminService;

import lombok.Data;

@Data
@Controller
@RequestMapping("/index_admin")
public class Index_adminHandler {
	
	@Resource
	private Index_adminService index_adminservice;
	
	//管理员页面顶部消息通知红字
	@RequestMapping("/showMesNum")
	@ResponseBody
	public Map<String,Object> showMesNum(){
		Map<String,Object> info=new HashMap<>();
		//查询未处理学员申诉数
		int unReadStudent=index_adminservice.countUnreadStudentCom();
		info.put("unReadStudent", unReadStudent);
		//查询未处理教练
		int unReadCoach=index_adminservice.countUnreadCoachCom();
		info.put("unReadCoach", unReadCoach);
		//查询未处理场馆
		int unReadGym=index_adminservice.countUnreadGymCom();
		info.put("unReadGym", unReadGym);
		return info;
	}
	
	//查询管理员后台主页要展示的数据信息
	@RequestMapping("/showNum")
	@ResponseBody
	public Map<String,Object> showNum(){
		Map<String,Object> info=new HashMap<>();
		//查询男学员数
		int maleStudent=index_adminservice.countMaleStudent();
		info.put("maleStudent", maleStudent);
		//查询女学生数
		int femaleStudent=index_adminservice.countFemaleStudent();
		info.put("femaleStudent", femaleStudent);
		//查询男教练数
		int maleCoach=index_adminservice.countMaleCoach();
		info.put("maleCoach", maleCoach);
		//查询女教练数
		int femaleCoach=index_adminservice.countFemaleCoach();
		info.put("femaleCoach", femaleCoach);
		//查询交易达成数
		int finishOrder=index_adminservice.countFinishOrder();
		info.put("finishOrder", finishOrder);
		//查询场馆总数
		int gymNum=index_adminservice.countGym();
		info.put("gymNum", gymNum);
		//查询认证教练数
		int authenticCoach=index_adminservice.countAuthenticCoach();
		info.put("authenticCoach", authenticCoach);
		//查询签约总数
		int countOrder=index_adminservice.countOrder();
		info.put("countOrder", countOrder);
		return info;
	}

}
